﻿{extend name="layout/main-block" /}
{block name="sub-wrapper"}
<!--内容容器-->
<section id="sub-wrapper" class="full-screen page-docManage">
    <!--数据展示容器-->
    <div id="sub-content">
        <div id="sub-header">
            <div class="sub-title">
                <h3><i class="fa fa-assistive-listening-systems"></i>系统管理--文档管理</h3>
            </div>
            <!--<div class="sub-tools">
                <div id="searchTool">
                    <form class="form-inline">
                        <input size="30" class="form-control" id="phname" placeholder="请输入文档名称进行检索" />

                        <a class="btn btn-primary" id="searchname"><i class="fa fa-search"></i>搜索</a>
                    </form>
                </div>
            </div>-->
        </div>
        <div class="table-responsive data-table">
            <table class="table table-striped table-bordered table-hover">
                <thead>
                    <tr>
                        <th class="text-center" width="34px">
                            <input type="checkbox" class="checkboxes" id="selectAll" />
                        </th>
                        <th>ID</th>
                        <th>文档名称</th>
                        <th>文档适用类型</th>
                        <th>创建时间</th>
                        <th>修改时间</th>
                        <th>创建人</th>
                        <th>最后修改人</th>
                        <th>备注</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                {volist name="docmanage" id="v" empty="$empty" }
                    <tr>
                        <td class="text-center">
                            <input type="checkbox" class="checkboxes" name="checkbox[]" />
                        </td>
                        <td>{$v.id}</td>
                        <td>{$v.dname}</td>
                        <td class="doctype">
                        {if condition = "$v.type_id eq '0'"}
                        协议文档
                        {elseif condition = "$v.type_id eq '1'"}
                        帮助文档
                        {elseif condition = "$v.type_id eq '2'"}
                        关于文档
                        {/if}
                        </td>
                        <td>{$v.created_at}</td>
                        <td>{$v.updated_at}</td>
                        <td>{$v.ausername}</td>
                        <td>{$v.busername}</td>
                        <td>{$v.remark}</td>
                        <td>
                            <ul class="record-tool">
                                <li><a class="btn btn-info btn-sm viewRecord" data-type="{$v.type_id}" data-name="{$v.id}">详情</a></li>
                                <li><a class="btn btn-warning btn-sm editRecord" data-type="{$v.type_id}" data-name="{$v.id}">修改</a></li>
                                <li><a class="btn btn-danger btn-sm delRecord" data-name="{$v.id}">删除</a></li>
                            </ul>
                        </td>
                    </tr>
                {/volist}
                </tbody>
                <tfoot>
                    <tr>
                        <td colspan="3">
                            <ul class="record-tool">
                                <li><a class="btn btn-success btn-sm" id="addRecord"><i class="fa fa-plus"></i>增加</a></li>
                                <li><a class="btn btn-danger btn-sm" id="batchDel"><i class="fa fa-minus"></i>批量删除</a></li>
                            </ul>
                        </td>
                        <td colspan="2" class="">
                            {$page}
                            <!--<ul class="pagination">
                                <li>
                                    <a href="#" aria-label="Previous">
                                        <span aria-hidden="true">&laquo;</span>
                                    </a>
                                </li>
                                <li class="active"><a href="#">1</a></li>
                                <li><a href="#">2</a></li>
                                <li><a href="#">3</a></li>
                                <li><a href="#">4</a></li>
                                <li><a href="#">5</a></li>
                                <li>
                                    <a href="#" aria-label="Next">
                                        <span aria-hidden="true">&raquo;</span>
                                    </a>
                                </li>
                            </ul>-->
                        </td>
                        <td colspan="3" class="text-center">
                            <div class="table-summary">
                                <div class="input-group">
                                    <div class="input-group-addon">到第</div>
                                    <input type="text" class="form-control" id="goto" placeholder="" style="width:40px;">
                                    <div class="input-group-addon">页</div>
                                    <span class="input-group-btn">
                                        <a class="btn btn-primary" id="gotoPage" data-currentPage="{$currentPage}" data-lastPage="{$lastPage}" ><i class="fa fa-arrow-right"></i>确定</a>
                                    </span>
                                </div>
                            </div>
                        </td>
                        <td colspan="2" class="text-center">
                            共<span id="total-record" class="text-success fa-2x"> {$count} </span>条记录
                        </td>
                    </tr>
                </tfoot>
            </table>
        </div>
    </div>
</section>
{/block}

{block name="docmanage"}
<!--编辑工具-->
<div id="docmanage" class="modal fade" tabindex="-1" role="dialog">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">ID:<span id="recordId"></span></h4>
            </div>
            <div class="modal-body">
                <div class="col-xs-12">
                    <form class="form-horizontal" name="editForm">
                        <div class="form-group">
                            <label>文档适用类型</label>
                            <input type="radio" class="type_id t1" name="type_id"  value="1"> 帮助文档
                            <input type="radio" class="type_id t0" name="type_id"  value="0"> 协议文档
                            <input type="radio" class="type_id t2" name="type_id"  value="2"> 关于文档
                        </div>
                        <div class="form-group">
                            <label for="name">文档名称</label>
                            <input type="text" class="form-control" id="name" name="name" >
                        </div>
                        <div class="form-group">
                            <label for="remark">备注</label>
                            <input type="text" class="form-control" id="remark" name="remark" >
                        </div>
                        <div class="form-group" id="agreement" style="display: none">
                            <label for="textcontent">协议内容</label>
                            <textarea class="form-control" id="textcontent" name="text0" rows="15"></textarea>
                        </div>
                        <div class="form-group" id="helpDoc" style="display: none">
                            <label for="ueditor">帮助文档内容</label>
                            <div class="col-sm-9 col-md-8  col-lg-9">
                                <!-- 加载编辑器的容器 -->
                                <script id="ueditor" name="text1" type="text/plain">
                                     初始化编辑内容
                                </script>
                            </div>
                        </div>
                        <div class="form-group" id="doc_about" style="display: none">
                            <label for="ueditor2">关于文档内容</label>
                            <div class="col-sm-9 col-md-8  col-lg-9">
                                <!-- 加载编辑器的容器 -->
                                <script id="ueditor2" name="text2" type="text/plain">
                                     初始化编辑内容
                                </script>
                            </div>
                            <!--<textarea class="form-control" id="textabout" name="text2" rows="15"></textarea>-->
                        </div>
                    </form>
                </div>
                <div class="clearfix"></div>
            </div>
            <div class="modal-footer">
                <a class="btn btn-warning" data-dismiss="modal"><i class="fa fa-times"></i>关闭</a>
            </div>
        </div>
    </div>
</div>
<!--编辑工具-->
{/block}

{block name="javascript"}
<!-- 配置文件 -->
<script type="text/javascript" src="assets/utf8-php/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="assets/utf8-php/ueditor.all.js"></script>
<!-- 实例化编辑器 -->
<script type="text/javascript">
    var ue = UE.getEditor('ueditor',{
        initialFrameHeight:"400",
        initialFrameWidth:"524",
    });
</script>
<script type="text/javascript">
    //var ue = UE.getContent();
    //console.log(ue);
    //对编辑器的操作最好在编辑器ready之后再做
    ue.ready(function() {
        //设置编辑器的内容
        ue.focus(true);
       // ue.setContent('{}');
        //获取html内容，返回: <p>hello</p>
        var html = ue.getContent();
        //获取纯文本内容，返回: hello
        var txt = ue.getContentTxt();
        //console.log(txt);
    });
</script>

<!-- 实例化编辑器 -->
<script type="text/javascript">
    var ue2 = UE.getEditor('ueditor2',{
        initialFrameHeight:"400",
        initialFrameWidth:"524",
    });
</script>
<script type="text/javascript">
    //var ue = UE.getContent();
    //console.log(ue);
    //对编辑器的操作最好在编辑器ready之后再做
    ue2.ready(function() {
        //设置编辑器的内容
        ue2.focus(true);
        // ue.setContent('{}');
        //获取html内容，返回: <p>hello</p>
        var html = ue2.getContent();
        //获取纯文本内容，返回: hello
        var txt = ue2.getContentTxt();
        //console.log(txt);
    });
</script>
{/block}
